package com.shiminghui;

import java.util.ArrayList;

public class Test2 {
    public static void main(String[] args) {

        ArrayList<Integer> arrayList = new ArrayList<>();

        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(3);
        arrayList.add(4);
        arrayList.add(5);

        System.out.print("[");
        for (int i = 0; i < arrayList.size(); i++) {
            if (i != arrayList.size() - 1)
                System.out.print(arrayList.get(i) + ",");
            else
                System.out.println(arrayList.get(i) + "]");
        }



    }
}
